#if !defined(ximera_math_util_hpp)
#define ximera_math_util_hpp

// -----------------------------------------------------------

#include <ximera/types.hpp>
#include <ximera/assert.hpp>
#include <ximera/exception.hpp>
#include <cmath>

namespace ximera { namespace math { namespace util
{
    Real const PI = 3.141592654f;
    Real const EPSILON = 0.00001f;
    Real const BIG_EPSILON = 0.01f;

    inline Real abs(Real x)
    {
        return std::abs(x);
    }

    inline Real sqrt(Real x)
    {
        return std::sqrt(x);
    }

    inline Real tan(Real x)
    {
        return std::tan(x);
    }

    inline Real atan(Real x)
    {
        return std::atan(x);
    }

    inline Real cos(Real x)
    {
        return std::cos(x);
    }

    inline Real acos(Real x)
    {
        return std::acos(x);
    }

    inline Real sin(Real x)
    {
        return std::sin(x);
    }

    inline Real asin(Real x)
    {
        return std::asin(x);
    }

    inline Real inv_sqrt(Real x)
    {
        return 1.0f / sqrt(x);
    }

    inline Real to_radians(Real degrees)
    {
        return degrees * PI / 180;
    }

    inline Real to_degrees(Real radians)
    {
        return radians * 180 / PI;
    }

    inline bool equal(Real lhs, Real rhs)
    {
        return (abs(lhs-rhs) < EPSILON);
    }
}}}

// -----------------------------------------------------------

#endif